<template>
<div 
    class="like-gradient-item box-shadow_2" 
    @click="toPath">
    <div class="container">
        <div 
            class="top"
            :style="itemData.gradient">
        </div>
        <div 
            class="remove" 
            @click.stop="onRemove">
            <Remove></Remove>
        </div>
    </div>
</div>
</template>

<script>
import Remove from '@/components/other/Remove';
export default {
    components: {Remove},
    props:{
        itemData:{ //对象数据
            type:Object,
            default:()=>{
                return {};
            },
        },
    },
    methods:{
        toPath(){
            this.$router.push({
                name:'Gradient',
                params:{
                    id:this.itemData.id,
                },
            }).catch(() => {return;});
        },
        onRemove(){
            this.$store.commit('deleteMyLike',{
                type:'gradient',
                id:this.itemData.id,
            });
        },
    },
}
</script>
<style lang="scss" scoped>
.like-gradient-item{
    width: 100%;
    border: none;
    background-color: white;
    box-sizing: border-box;
    border-radius: 5px;
    padding: 3px;
    >.container{
        overflow: hidden;
        position: relative;
        border-radius: 3px;
        >.top{
            width: 100%;
            position: relative;
            height: 60px;
            cursor: pointer;
        }
        >.remove{
            position: absolute;
            top: 3px;
            right: 3px;
            opacity: 0;
            transition: all 0.2s;
            /deep/.remove{
                font-size: 1.1rem;
                width: 15px;
                height: 15px;
            }
        }
        &:hover{
            >.remove{
                opacity: 1;
            }
        }
    }
    
}
</style>

